feat: add box-basic implementation (9 libraries)#509
Conversation
## Summary Implements `box-basic` for **pygal** library. **Parent Issue:** #203 **Sub-Issue:** #256 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/pygal/box/box-basic/default.py` ## Changes - Simplified implementation to follow KISS principle (no functions, no classes) - Uses project color palette (#306998, #FFD43B, #DC2626, #059669, #8B5CF6, #F97316) - Set dimensions to 4800x2700 px as per style guide - Increased font sizes for readability at target resolution - Legend placed at bottom - Clean, sequential code structure following matplotlib gallery example style Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **plotnine** library. **Parent Issue:** #203 **Sub-Issue:** #249 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/plotnine/boxplot/box-basic/default.py` ## Details - KISS-style implementation following project guidelines - Uses style guide colors for the 4 groups - 16:9 aspect ratio (16 x 9 inches at 300 DPI = 4800 x 2700 px) - Proper font sizing per style guide (title: 20pt, axis labels: 20pt, tick labels: 16pt) - Legend hidden since group colors are distinguished by x-axis labels Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **seaborn** library. **Parent Issue:** #203 **Sub-Issue:** #220 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/seaborn/boxplot/box-basic/default.py` ## Changes - Simplified implementation to follow KISS principles (sequential script, no functions) - Uses style guide color palette (#306998, #FFD43B, #DC2626, #059669) - Follows seaborn 0.14+ API (uses `hue` with `palette`, `legend=False`) - Uses spec-defined sample data (4 groups with different distributions) - Properly sized output (16:9 aspect ratio, 300 DPI) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **letsplot** library. **Parent Issue:** #203 **Sub-Issue:** #269 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/letsplot/boxplot/box-basic/default.py` ## Details - Creates basic box-and-whisker plot comparing statistical distributions across 4 groups (A, B, C, D) - Uses lets-plot's grammar of graphics syntax (ggplot2-style) - Applies project color palette (#306998, #FFD43B, #DC2626, #059669) - Outputs 4800 x 2700 px PNG (16:9 aspect ratio per style guide) - Typography scaled appropriately for output dimensions Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **matplotlib** library. **Parent Issue:** #203 **Sub-Issue:** #214 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/matplotlib/boxplot/box-basic/default.py` ## Changes - Simplified from function-based to sequential KISS style - Uses color palette from default style guide - Uses `tick_labels` parameter for matplotlib 3.9+ compatibility - Clear axis labels, title, and grid styling - Output at 4800x2700px (16:9 aspect ratio at 300 DPI) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **altair** library. **Parent Issue:** #203 **Sub-Issue:** #242 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/altair/boxplot/box-basic/default.py` ## Changes - Rewrote implementation to follow KISS style guide (simple script, no functions/classes) - Uses the project color palette from style guide - Outputs PNG at 4800x2700 via scale_factor=3.0 - Uses `mark_boxplot()` for clean box-and-whisker visualization - Includes proper axis labels and title with appropriate font sizes Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **plotly** library. **Parent Issue:** #203 **Sub-Issue:** #226 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/plotly/box/box-basic/default.py` ## Changes - Simplified implementation following KISS principles (no functions, no classes) - Uses `go.Box` traces with style guide colors - Displays outliers as individual points - Clean layout with `plotly_white` template - Proper font sizes scaled for 4800x2700px output Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **highcharts** library. **Parent Issue:** #203 **Sub-Issue:** #263 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/highcharts/boxplot/box-basic/default.py` ## Changes - Rewrote implementation to follow KISS style (no functions, no classes) - Uses proper color palette from style guide (#306998, #FFD43B, #059669, #8B5CF6) - Target dimensions: 4800x2700px (16:9 aspect ratio) - Calculates quartiles, whiskers, and detects outliers per 1.5×IQR rule - Includes outliers as separate scatter series with red markers - Downloads Highcharts JS inline for headless Chrome compatibility - Uses `highcharts-more.js` required for boxplot chart type Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **altair** library. **Parent Issue:** #204 **Sub-Issue:** #400 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/altair/boxplot/box-basic/default.py` ## Features - Box plot with four groups (A, B, C, D) showing statistical distributions - Uses style guide color palette (#306998, #FFD43B, #DC2626, #059669) - Proper axis labels and title with appropriate font sizes - Subtle grid for visual clarity (0.3 opacity) - Output: 4800 × 2700 px via scale_factor=3.0 Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **highcharts** library. **Parent Issue:** #204 **Sub-Issue:** #404 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/highcharts/boxplot/box-basic/default.py` ## Changes - Refactored box plot implementation with simplified code structure - Improved outlier detection using numpy percentile calculations - Uses Python Blue (#306998) for box fill with Signal Red (#DC2626) for median line and outliers - Proper calculation of whisker ends at the most extreme data points within 1.5×IQR bounds - Downloads both highcharts.js and highcharts-more.js (required for boxplot) - Uses element screenshot for accurate dimensions Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **pygal** library. **Parent Issue:** #204 **Sub-Issue:** #332 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/pygal/box/box-basic/default.py` ## Details - Uses pygal.Box() for box-and-whisker plot visualization - Displays four groups with different distributions (Group A, B, C, D) - Custom styling with project color palette (#306998, #FFD43B, #DC2626, #059669) - White background with readable font sizes - 4800 × 2700 px output (16:9 aspect ratio) - Legend at bottom showing all groups Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **pygal** library. **Parent Issue:** #204 **Sub-Issue:** #451 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/pygal/box/box-basic/default.py` ## Details - Creates a box-and-whisker plot comparing four groups (A, B, C, D) - Uses the project color palette (#306998, #FFD43B, #DC2626, #059669) - Outputs 4800 × 2700 px PNG as required - Includes proper axis labels (Group, Value) and title Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **letsplot** library. **Parent Issue:** #204 **Sub-Issue:** #335 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/letsplot/boxplot/box-basic/default.py` ## Details - Uses `geom_boxplot()` for box-and-whisker visualization - Four groups (A, B, C, D) with different normal distributions - Color palette from style guide (#306998, #FFD43B, #DC2626, #059669) - Legend hidden since groups are labeled on x-axis - Output size: 4800x2700 px (via `ggsize(1600, 900)` with `scale=3`) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **highcharts** library. **Parent Issue:** #204 **Sub-Issue:** #439 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/highcharts/boxplot/box-basic/default.py` ## Changes - Box plot with four groups (A, B, C, D) showing statistical distributions - Displays quartiles (Q1, median, Q3), whiskers (1.5×IQR), and outliers - Uses Python Blue (#306998) for box fill and Signal Red (#DC2626) for outliers and median line - Proper 4800×2700 px output dimensions Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **bokeh** library. **Parent Issue:** #204 **Sub-Issue:** #233 **Base Branch:** `plot/box-basic` **Attempt:** 2/3 ## Implementation - `plots/bokeh/custom/box-basic/default.py` ## Features - Clean KISS-style implementation (no functions, no classes) - Uses spec-defined data structure with `group` and `value` columns - Displays Q1, median, Q3 boxes with whiskers extending to 1.5×IQR - Shows outliers as individual red points (#DC2626) - Correct figure dimensions (4800×2700 px) - Font sizes match default-style-guide.md recommendations (20pt labels, 16pt ticks) - Uses style guide color palette (#306998, #FFD43B, #DC2626, #059669) ## Changes in This Attempt - Updated to use the official style guide color palette instead of Category10_4 - Selenium dependencies already added for PNG export --------- Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **highcharts** library. **Parent Issue:** #204 **Sub-Issue:** #462 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/highcharts/boxplot/box-basic/default.py` ## Changes - Improved box plot statistics calculation - Added colorByPoint option for distinct box colors - Enhanced font sizes for better readability at 4800x2700px - Added legend with proper styling - Improved outlier marker styling - Fixed window-size to match target dimensions (4800x2700) Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
## Summary Implements `box-basic` for **pygal** library. **Parent Issue:** #204 **Sub-Issue:** #461 **Base Branch:** `plot/box-basic` **Attempt:** 1/3 ## Implementation - `plots/pygal/box/box-basic/default.py` ## Details - Uses `pygal.Box()` to create box-and-whisker plots - Compares statistical distributions across 4 groups (A, B, C, D) - Each group has 50 data points with different means and standard deviations - Output size: 4800 × 2700 px (16:9 aspect ratio) - Custom styling using project color palette (#306998, #FFD43B, #DC2626, #059669, #8B5CF6, #F97316) - Shows quartiles, whiskers, and outliers for each group Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request implements the box-basic plot specification across all 9 supported visualization libraries, transitioning from the old function-based pattern to the new KISS-style (Keep It Simple, Stupid) approach. Each implementation creates a box-and-whisker plot comparing statistical distributions across four groups (A, B, C, D), with consistent data generation, styling, and output dimensions.
Key Changes:
- Removed
create_plot()function pattern in favor of simple, linear scripts (imports → data → plot → save) - Simplified docstrings from multi-line format to concise "Library: {name}" format
- Removed type hints,
if __name__ == "__main__", and extensive docstrings per KISS pattern - Standardized on 4800 × 2700 px output across all libraries (via different scaling approaches)
- Applied consistent color palette from style guide: #306998, #FFD43B, #DC2626, #059669
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
plots/matplotlib/boxplot/box-basic/default.py |
Matplotlib implementation using ax.boxplot() with custom box coloring and styling |
plots/seaborn/boxplot/box-basic/default.py |
Seaborn implementation using sns.boxplot() with hue encoding and style guide colors |
plots/plotly/box/box-basic/default.py |
Plotly implementation using go.Box() traces with interactive features and custom layout |
plots/bokeh/custom/box-basic/default.py |
Bokeh implementation with manual box plot construction (vbar + whiskers + outliers) |
plots/altair/boxplot/box-basic/default.py |
Altair declarative implementation using mark_boxplot() with custom color scale |
plots/plotnine/boxplot/box-basic/default.py |
Plotnine (ggplot2-style) implementation using geom_boxplot() with theme customization |
plots/pygal/box/box-basic/default.py |
Pygal SVG implementation using pygal.Box() with custom style configuration |
plots/letsplot/boxplot/box-basic/default.py |
LetsPlot (JetBrains) implementation using geom_boxplot() with ggplot2 grammar |
plots/highcharts/boxplot/box-basic/default.py |
Highcharts implementation with manual statistics calculation and Selenium-based PNG export |
| ) | ||
|
|
||
| # Color the boxes | ||
| colors = ["#306998", "#FFD43B", "#059669", "#8B5CF6"] |
There was a problem hiding this comment.
The color palette order is incorrect. According to the style guide (prompts/default-style-guide.md), colors should be used in this order:
- #306998 (Python Blue)
- #FFD43B (Python Yellow)
- #DC2626 (Signal Red) ← Missing
- #059669 (Teal Green)
Change line 47 to:
colors = ["#306998", "#FFD43B", "#DC2626", "#059669"]| colors = ["#306998", "#FFD43B", "#059669", "#8B5CF6"] | |
| colors = ["#306998", "#FFD43B", "#DC2626", "#059669"] |
| chart = pygal.Box( | ||
| width=4800, | ||
| height=2700, | ||
| title="Distribution Comparison by Group", |
There was a problem hiding this comment.
The title "Distribution Comparison by Group" is inconsistent with other implementations, which all use "Basic Box Plot". For consistency across all 9 library implementations, change to:
title="Basic Box Plot",| title="Distribution Comparison by Group", | |
| title="Basic Box Plot", |
| chrome_options.add_argument("--window-size=4800,2700") | ||
|
|
||
| driver = webdriver.Chrome(options=chrome_options) | ||
| driver.get(f"file://{temp_path}") |
There was a problem hiding this comment.
The file:// URL format is missing a slash. It should be file:///{temp_path} (three slashes) for proper file URL format on Unix/Linux systems, though file://{temp_path} may work on some systems.
Change to:
driver.get(f"file:///{temp_path}")| driver.get(f"file://{temp_path}") | |
| driver.get(f"file:///{temp_path}") |
| whisker_low = max(values.min(), q1 - 1.5 * iqr) | ||
| whisker_high = min(values.max(), q3 + 1.5 * iqr) |
There was a problem hiding this comment.
Lines 47-48 calculate whisker_low and whisker_high but these variables are never used. The actual whisker values used in line 54 are lower_whisker and upper_whisker from lines 51-52. Remove the unused variables:
# Remove these lines:
whisker_low = max(values.min(), q1 - 1.5 * iqr)
whisker_high = min(values.max(), q3 + 1.5 * iqr)| whisker_low = max(values.min(), q1 - 1.5 * iqr) | |
| whisker_high = min(values.max(), q3 + 1.5 * iqr) |
Summary
Adds
box-basicplot implementation.Libraries
Links
specs/box-basic.md🤖 Auto-generated by pyplots CI